package com.funo.wcity.app.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.funo.wcity.app.entity.TblMailAnnex;
import com.funo.wcity.app.utils.StringUtil;

@Repository("tblMailAnnexDAO")
public class TblMailAnnexDAO extends DefaultBaseDao<TblMailAnnex,Integer>{

	public List getTblMailAnnexList(String idMailAnnex,Integer status) {
		StringBuffer hql=new StringBuffer("From  TblMailAnnex m where 1=1");
		hql.append(" and ','||'").append(idMailAnnex).append("'||','")
		.append(" like '%,'||m.idMailAnnex||',%'");
		if(!StringUtil.isEmpty(status)){
			hql.append(" and m.status=").append(status);
		}
		hql.append(" order by m.lastDate asc");
		return this.hibernateTemplate.find(hql.toString());
	}
}
